<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use DB;

class clearData extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'clearData:data';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '初始化脚本';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        DB::table('users')->truncate();
        DB::table('users_auth')->truncate();
        DB::table('users_capital')->truncate();
        DB::table('users_appkey')->truncate();
        DB::table('users_integral_log')->truncate();
        DB::table('users_kill_status')->truncate();
        DB::table('user_submit_audit')->truncate();
        DB::table('users_recharge_log')->truncate();
        DB::table('users_voucher_log')->truncate();
        DB::table('smscodes')->truncate();
        DB::table('statistics_user')->truncate();
        DB::table('statistics_user_kill')->truncate();
        DB::table('goods_audit')->truncate();
        DB::table('goods_correction')->truncate();
        DB::table('goods_coupon')->truncate();
        DB::table('goods_kill')->truncate();
        DB::table('goods_sales')->truncate();
        DB::table('goods_shop')->truncate();
        DB::connection('mysql')->select(" SET FOREIGN_KEY_CHECKS=0 ");
        DB::table('goods')->truncate();
        DB::connection('mysql')->select(" SET FOREIGN_KEY_CHECKS=1 ");
        DB::table('statistics_user_voucher')->truncate();
        DB::table('statistics_sales_log')->truncate();
        DB::table('goods_coupon_backups')->truncate();
        DB::table('oauth_access_tokens')->truncate();
        DB::table('goods_copywriting_error')->truncate();
        DB::table('update_log')->truncate();
        DB::table('statistics_goods_info')->truncate();
        DB::table('statistics_goods_info_log')->truncate();
    }
}
